package com.sisyphus.simple;

import android.view.View;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.sisyphus.spinach.core.INetPageTask;
import com.sisyphus.spinach.network.views.SmartRefreshList;
import com.sisyphus.spinach.ui.configs.impl.DefaultActivityPageTemplate;

import androidx.recyclerview.widget.RecyclerView;

public abstract class SimpleAppActivityListTemplate<T> extends DefaultActivityPageTemplate<T> {

    public SimpleAppActivityListTemplate() {
        super();
    }

    public SimpleAppActivityListTemplate(View contentView) {
        super(contentView);
    }

    @Override
    public INetPageTask.View<T> view(RecyclerView recyclerView, SmartRefreshLayout refreshLayout) {
        // 列表样式
        recyclerView.setHasFixedSize(true);

        // 网络任务view
        INetPageTask.View<T> view = super.view(recyclerView, refreshLayout);
        if (view instanceof SmartRefreshList) {
            SmartRefreshList<T> pagination = (SmartRefreshList<T>) view;
            pagination.setNotMoreFooterLayoutResId(R.layout.layout_list_not_more);
            pagination.setEmptyLayoutResId(R.layout.layout_list_empty);
        }

        return view;
    }

}
